#ifndef __SC7122_H_
#define __SC7122_H_


#ifndef NULL
 #define NULL ((void *) 0)
#endif

#define  SL_SC7A20_SPI_IIC_MODE       1  
#define SC7A20_SDO_VDD_GND            1   

#if SC7A20_SDO_VDD_GND==0
#define SC7A20_IIC_7BITS_ADDR        0x18
#define SC7A20_IIC_8BITS_ADDR        0x30
#else
#define SC7A20_IIC_7BITS_ADDR        0x19
#define SC7A20_IIC_8BITS_ADDR        0x32
#endif

#define   IMU_IIR_ADR  0X18
#define   WHO_AM_I_REG  0X01
#define   WHO_AM_I_VAL  0X6A  
#define GYRO_VERIFY_ID_REPEAT_TIMES     100
#define IMU_BUF_SIZE                  20

#define ACC_RANGE_REG				0X41
#define ACC_RANGE_2G 				0x00
#define ACC_RANGE_4G 				0x01
#define ACC_RANGE_8G 				0x02
#define ACC_RANGE_16G 				0x03
#define ACC_RANGE_SEL				ACC_RANGE_16G

#define GYRO_RANGE_REG					0X43
#define GYRO_RANGE_1000dps 				0x09
#define GYRO_RANGE_2000dps 				0x08
#define GYRO_RANGE_SEL						GYRO_RANGE_2000dps

#define ACC_GYRO_EN_REG						0x7d
#define ACC_EN										0x05
#define GYRO_EN										0x02


#define GYRO_CONF									0x42
#define ACC_CONF									0x40

#define GYRO_HIGH									0x80				//������
#define ACC_HIGH									0x80				//������

#define GYRO_NOISE									0x40

#define GYRO_AVE4									0x20
#define GYRO_AVE2									0x10
#define GYRO_AVE1									0x00
#define ACC_AVE4									0x20
#define ACC_AVE2									0x10
#define ACC_AVE1									0x00

#define GYRO_400HZ									0x0a
#define GYRO_800HZ									0x0b
#define ACC_400HZ									0x0a
#define ACC_800HZ									0x0b

typedef struct
{
    short ax;
    short ay;
    short az;
    short gx;
    short gy;
    short gz;
} _st_SC7I22;

typedef struct
{
    float pitch;
    float roll;
    float yaw;
} _st_Angle;



void sc7122_init(void);
void get_acc_gyro_raw_SC7112(_st_SC7I22 * Data);

#endif

